<template>
  <div style="height: 100%; width: 100%; position: relative; overflow: hidden">
      <rm-layout-right splitcolor="#FFFFFF" movingcolor="#CCFFFF" :splitwidth="5" :fixsize="586">
          <div class="page-content">
              <div class="page-top" style="border: 1px solid #ccc">
                  <div style="min-width: 430px">
                      <div class="page-top-info">
                          <div class="search-title">条码号</div>
                          <div class="el-input el-input--small search-text">
                              <input ref="reqbarcode" class="el-input__inner" :value="barcode" @focus="getFocus" @blur="updateCode" @keyup.enter="scanBarcode" :disabled="txtreqbarcodedisabled" placeholder="条码号" style="width: 230px" />
                          </div>
                      </div>
                      <div class="right-top-deal">
                          <div v-if="mixnum > 1">当前混样条码号：<span style="font-weight: bold" v-html="mixbarcode"></span></div>
                          <div v-else>单独采样条码</div>
                          <div>
                              <el-button icon="el-icon-delete" @click="deleteSample('xTable')">删除</el-button>
                              <el-button v-if="mixnum > 1" @click="acceptSample">混采完成</el-button>
                              <el-button icon="el-icon-printer" @click="btnPrint(1)">打印</el-button>
                          </div>
                      </div>
                  </div>
              </div>
              <div class="page-bottom">
                  <vxe-table ref="xTable" :data.sync="reqList" class="mytable-style" height="auto" border size="mini" resizable stripe :sort-config="{ trigger: 'cell' }" show-header-overflow show-overflow highlight-current-row header-align="center">
                      <vxe-table-column field="seq" title="序号" width="40" align="center"></vxe-table-column>
                      <vxe-table-column field="barcode" sortable title="条码号" width="90"></vxe-table-column>
                      <vxe-table-column field="pat_name" sortable title="姓名" width="80" align="center"></vxe-table-column>
                      <vxe-table-column field="pat_sexname" sortable title="性别" width="40" align="center"></vxe-table-column>
                      <vxe-table-column field="pat_agestr" sortable title="年龄" width="40"></vxe-table-column>
                      <vxe-table-column field="specimen_name" sortable title="标本类型" width="80"></vxe-table-column>
                      <vxe-table-column field="sample_items" sortable title="项目描述" width="200"></vxe-table-column>
                      <vxe-table-column field="add_dt" sortable title="采样时间" width="120"></vxe-table-column>
                      <vxe-table-column field="req_statname" sortable title="申请状态" width="60" align="center"></vxe-table-column>
                  </vxe-table>
              </div>
          </div>
          <template v-slot:fix>
              <rm-layout-top splitcolor="#ffffff" :splitwidth="5" :fixsize="380">
                  <template v-slot:fix>
                      <div class="page-content">
                          <div class="page-top" style="border: 1px solid #ccc">
                              <div style="min-width: 580px">
                                  <div class="page-top-info">
                                      <div class="search-title">混样日期</div>
                                      <el-date-picker v-model="searchParam.startdt" type="datetime" placeholder="开始日期" value-format="yyyy-MM-dd HH:mm:ss" clearable style="width: 160px" @change="queryList"></el-date-picker>
                                      <span style="margin: 0 5px"> - </span>
                                      <el-date-picker v-model="searchParam.enddt" type="datetime" placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" clearable style="width: 160px" @change="queryList"></el-date-picker>
                                      <!-- <div class="search-title" style="padding-left: 10px;">混样人</div>
                                      <div class="search-text">
                                          <rm-ddl-common v-model="searchParam.mixuser" datatype="userinfo" kindno="1" width="130px" @change="queryList"></rm-ddl-common>
                                      </div> -->
                                      <!-- <div class="search-title">条码号</div>
                                      <div class="search-text">
                                          <el-input v-model="searchParam.txtbarcode" size="mini" style="width:130px" clearable @keyup.enter.native="queryList"></el-input>
                                      </div> -->
                                  </div>
                                  <div class="top-deal">
                                      <div style="float:left; margin: 0 5px;">混样条码</div>
                                      <div style="float:left;">
                                          <el-input v-model="searchParam.txtbarcode" size="small" style="width:138px" clearable @keyup.enter.native="queryList"></el-input>
                                      </div>
                                      <div style="float:left; margin: 0 5px;">采样状态</div>
                                      <div style="float:left;">
                                          <el-select v-model="sampstate" @change="queryList" @dblclick.native="popMultipleChk(sampstate,'sampstate',stateOption,'采样状态选择')" placeholder="" style="width:138px" filterable clearable>
                                              <el-option v-for="(item,index) in stateOption" :key="index" :value="item.data" :label="item.display"></el-option>
                                          </el-select>
                                      </div>
                                      <el-button icon="el-icon-search" type="primary" @click="btnqueryList">查询</el-button>
                                      <!-- <el-button icon="el-icon-delete" @click="mainDeal(1)">删除</el-button> -->
                                      <el-button icon="el-icon-printer" @click="btnPrint(2)">打印</el-button>
                                  </div>
                              </div>
                          </div>
                          <div class="page-bottom">
                              <vxe-table ref="reqGroup" :data.sync="reqGroupList" :loading="reqGroupLoading" class="mytable-style" height="auto" border size="mini" show-header-overflow highlight-current-row resizable stripe header-align="center" show-overflow :sort-config="{ trigger: 'cell' }" @current-change="currentChangeEvent">
                                  <vxe-table-column type="index" title="序号" width="40" align="center"></vxe-table-column>
                                  <vxe-table-column field="mixbarcode" sortable title="混样条码" width="110"></vxe-table-column>
                                  <vxe-table-column field="mix_user" sortable title="混样人" width="80" align="center"></vxe-table-column>
                                  <!-- <vxe-table-column field="mixtype" sortable title="混样类型" width="80"></vxe-table-column> -->
                                  <vxe-table-column field="mix_dt" sortable title="混样时间" width="120"></vxe-table-column>
                                  <vxe-table-column field="mixnum" sortable title="包含样本数" width="80" align="center"></vxe-table-column>
                                  <vxe-table-column field="statname" sortable title="状态" width="80" align="center"></vxe-table-column>
                              </vxe-table>
                          </div>
                      </div>
                  </template>
                  <div class="page-content table-bottom-content">
                      <vxe-table show-overflow ref="preReq" :data.sync="preReqList" :loading="preReqLoading" class="mytable-style" height="auto" border size="mini" :sort-config="{ trigger: 'cell' }" show-header-overflow highlight-current-row resizable stripe header-align="center">
                          <vxe-table-column title="删除" width="40px" align="center">
                              <template v-slot="{ row }">
                                  <!-- <el-button class="el-button--310" style="padding: 5px 10px !important;" @click="childrenDeal(row)">删除</el-button> -->
                                  <i class="el-icon-delete" style="padding: 5px 10px !important" @click="childrenDeal(row)"></i>
                              </template>
                          </vxe-table-column>
                          <vxe-table-column type="index" title=" 序号" width="40" align="center"></vxe-table-column>
                          <vxe-table-column field="barcode" sortable title="条码号" width="90"></vxe-table-column>
                          <vxe-table-column field="pat_name" sortable title="姓名" width="80" align="center"></vxe-table-column>
                          <vxe-table-column field="pat_sexname" sortable title="性别" width="40" align="center"></vxe-table-column>
                          <vxe-table-column field="pat_agestr" sortable title="年龄" width="40"></vxe-table-column>
                          <vxe-table-column field="pat_no" title="病人号" width="80"></vxe-table-column>
                          <vxe-table-column field="pat_idcardno" title="身份证号" width="80"></vxe-table-column>
                          <vxe-table-column field="pat_phone" title="联系电话" width="80"></vxe-table-column>
                          <vxe-table-column field="add_dt" sortable title="混样时间" width="120"></vxe-table-column>
                          <vxe-table-column field="add_username" sortable title="混样人" width="80" align="center"></vxe-table-column>
                          <vxe-table-column field="specimen_name" sortable title="标本类型" width="80"></vxe-table-column>
                          <vxe-table-column field="sample_items" sortable title="项目描述" width="120"></vxe-table-column>
                          <vxe-table-column field="req_docname" title="申请医生" width="120"></vxe-table-column>
                          <vxe-table-column field="req_deptname" title="申请科室" width="130" header-align="center"></vxe-table-column>
                          <vxe-table-column field="pat_address" title="病人联系地址" width="180" header-align="center"></vxe-table-column>
                          <vxe-table-column field="pat_cardno" title="就诊卡号" width="100" header-align="center"></vxe-table-column>
                          <vxe-table-column field="inp_id" title="住院标识" width="100" header-align="center"></vxe-table-column>
                          <vxe-table-column field="pat_id" title="病人唯一号" width="100" header-align="center"></vxe-table-column>
                          <!-- <vxe-table-column field="req_statname" sortable title="申请状态" width="60" align="center"></vxe-table-column> -->
                          <template v-slot:fix>
                              <div class="detail-info">
                                  <div class="search-title">新增明细条码号：</div>
                                  <!-- <div class="search-text">
                                      <el-input ref="detailBarcode" v-model="detailBarcode" size="mini" style="width:130px" clearable @focus="$refs.detailBarcode.select()" @keyup.enter.native="addDetail"></el-input>
                                  </div> -->
                                  <div class="el-input el-input--small search-text">
                                      <input ref="detailBarcode" class="el-input__inner" :value="detailBarcode" @focus="$refs.detailBarcode.select()" :disabled="isadddetail" @blur="updateDetBarcode" @keyup.enter="addDetail" placeholder="条码号" style="width: 230px" />
                                  </div>
                              </div>
                          </template>
                      </vxe-table>
                  </div>
              </rm-layout-top>

              <!--多选弹窗--->
              <el-dialog width="900px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :title="multichktitle" :visible.sync="dialogMultipleVisible" :destroy-on-close="true">
                  <rm-SqlMultiple :leftOption="option1" :rightOption="option2" :name="fieldname" @change="closedialog"></rm-SqlMultiple>
              </el-dialog>
          </template>
      </rm-layout-right>
  </div>
</template>

<script>
import XEUtils from "xe-utils"; //引入工具类
export default {
  name: "REQ112",
  data() {
      return {
          barstyleid: "",
          barcode: "",
          mixbarcode: "",
          searchParam: {
              startdt: XEUtils.toDateString(new Date(), "yyyy-MM-dd 00:00:00"),
              enddt: XEUtils.toDateString(new Date(), "yyyy-MM-dd 23:59:59"),
              mixuser: "",
              txtbarcode: "",
          },
          sampstate: "",
          reqList: [],
          selrow: {},
          reqGroupList: [],
          reqGroupLoading: false,
          preReqList: [],
          preReqLoading: false,
          detailBarcode: "",
          mixnum: 5,
          isadddetail: false,
          txtreqbarcodedisabled: false,
          selgroupbarcode:"",
          dialogMultipleVisible: false,
          fieldname: "",
          option2: [],
          option1: [],
          multichktitle: "",
          stateOption: [],
      };
  },
  activated() {
      this.$refs.reqbarcode.focus();
      this.$refs.reqbarcode.select();
  },
  mounted() {
      this.getFocus();
      this.init();
      // this.searchParam.mixuser = this.$tool.getSession(this.$tool.loginuserno);
      this.queryList();
  },
  methods: {
      init() {
          this.$tool
              .request({
                  url: "REQ/REQ1/REQ112",
                  method: "post",
                  data: {
                      action: "initoptions",
                  },
              })
              .then((response) => {
                  if (response.barstyleid) this.barstyleid = response.barstyleid;

                  this.stateOption = response.stateOption;
              })
              .catch((e) => {});
      },
      getFocus() {
          this.txtreqbarcodedisabled = false;
          this.$nextTick(() => {
              this.$refs.reqbarcode.focus();
              this.$refs.reqbarcode.select();
          });
      },
      updateCode() {
          this.barcode = this.$refs.reqbarcode.value;
      },
      updateDetBarcode() {
          this.detailBarcode = this.$refs.detailBarcode.value;
      },
      popMultipleChk(e, fieldname, option, title) {
          let temp = XEUtils.clone(option, true);
          this.option1 = [];
          this.option2 = [];
          if (e != "") {
              let k = e.split(",");
              k.forEach(item => {
                  let ndata = temp.find(m => m.data == item);
                  if (ndata != undefined && ndata != null) {
                      this.option2.push(ndata);
                  }
              });
              temp.forEach(item => {
                  if (k.indexOf(item.data + "") < 0) {
                      this.option1.push(item);
                  }
              });
          } else {
              this.option1 = temp;
          }
          this.fieldname = fieldname;
          this.multichktitle = title;
          this.dialogMultipleVisible = true;
      },
      closedialog(value, name) {
          if (value != "close") {
              this[name] = value;
          }
          this.dialogMultipleVisible = false;
      },
      scanBarcode(e) {
          if (!e.target.value) return false;
          //防止数据并发
          this.txtreqbarcodedisabled = true;
          let that = this;
          this.barcode = e.target.value;
          that.scanDetBarcode(that.barcode, that.mixbarcode, 0, 0).then((response) => {
              if (response.flag == 1) {
                  //更新混样主条码包含明细条码的数量
                  this.$tool
                          .request({
                                  url: "REQ/REQ1/REQ112",
                                  method: "post",
                                  data: {
                                      action: "updatemixnum",
                                      mixbarcode: response.mixbarcode,
                                  },
                          })
                          .then((res) => {
                              if (res.flag == "-1") {
                                  that.$pub.message(that, res.msg, "warning");
                              }
                              else{
                                  that.mixnum = response.mixnum;
                                  if (response.isfirst) {
                                      // 第一个条码
                                      if (that.reqList && that.reqList.length > 0) {
                                          // 右侧第一行插入当前数据，清空旧数据
                                          that.addReqGroup();
                                      }
                                      that.mixbarcode = response.mixbarcode;
                                      that.$pub.message(that, "请注意：开始新的混样！", "warning");
                                  } else if (response.isend) {
                                      // 最后一个条码
                                      that.$pub.message(that, "请注意：本条码采样后达到最大混样数！", "warning");
                                  }
                                  if (response.mixnum == 1) {
                                      that.$pub.message(that, "请注意：本条码是单独采样的条码！", "warning");
                                  }
                                  // var newRow = response.master;
                                  // newRow.seq = response.seq;
                                  // // var allData = newRow.concat(this.reqList);
                                  // var allData = this.reqList.concat(newRow);
                                  that.reqList = response.allData;
                                  that.$refs.xTable.loadData(that.reqList).then(() => {
                                      let newRow = that.reqList.find((t) => t.barcode == that.barcode);
                                      if (newRow) {
                                          that.$refs.xTable.setCurrentRow(newRow);
                                          that.$refs.xTable.scrollToRow(newRow);
                                      }
                                      // that.getFocus();
                                  });
                                  if (response.isprint) that.btnPrint(1);
                                  that.getFocus();
                                  that.queryList();
                              }
                          })
              } else {
                  that.$confirm(response.msg, "提示", {
                      confirmButtonText: "确定",
                      cancelButtonText: "取消",
                      type: "error",
                  })
                      .then(() => {
                          that.getFocus();
                      })
                      .catch(() => {
                          that.getFocus();
                      });
              }
          });
      },
      acceptSample() {
          if (this.reqList && this.reqList.length > 0) {
              this.addReqGroup();
              this.getFocus();
              //更新混样主条码包含明细条码的数量
              const res = this.$tool.request({
                      url: "REQ/REQ1/REQ110",
                      method: "post",
                      data: {
                          action: "updatemixnum",
                          barcode: this.mixbarcode,
                      },
              });
          } else {
              this.$alert("当前没有混样");
          }
      },
      addReqGroup() {
          let row = {
              mixbarcode: this.mixbarcode,
              mix_user: this.$tool.getSession(this.$tool.loginusername),
              mix_dt: this.reqList[0].add_dt,
              mixnum: this.reqList.length,
              statname: "采样",
              req_stat: "2",
          };
          this.reqGroupList.unshift(row);
          this.reqList = [];
          this.mixbarcode = "";
          this.$refs.reqGroup.setCurrentRow(row).then(() => {
              this.$refs.reqGroup.scrollToRow(row);
              this.selrow = row;
              this.getDetailList(row);
          });
      },
      btnPrint(type) {
          let mixbarcode = "";
          if (type == 1) {
              mixbarcode = this.mixbarcode;
          } else if (type == 2) {
              let row = this.$refs.reqGroup.getCurrentRow();
              if (row) mixbarcode = row.mixbarcode;
          }
          if (!this.barstyleid) {
              this.$pub.message(this, "没有维护条码样式", "warning");
          } else {
              this.$pub.printbarcode(this, mixbarcode, "1", this.barstyleid, "");
          }
      },
      btnqueryList(){
          this.selgroupbarcode ="";
          this.queryList();
      },
      queryList() {
          this.reqGroupLoading = true;
          this.$tool
              .request({
                  url: "REQ/REQ1/REQ112",
                  method: "post",
                  data: {
                      action: "querymixsamplelist",
                      sampstate: this.sampstate,
                      ...this.searchParam,
                  },
              })
              .then((response) => {
                  this.reqGroupLoading = false;
                  this.reqGroupList = response.mixlist;
                  if (this.reqGroupList.length > 0) {
                      if(this.selgroupbarcode == ""){
                          this.selrow = this.reqGroupList[0];
                      }
                      var row = this.reqGroupList.filter(m=>m.mixbarcode ==  this.selrow.mixbarcode)[0];
                      this.$refs.reqGroup.setCurrentRow(row);
                      this.getDetailList(row);
                  }
              })
              .catch((e) => {
                  this.reqGroupLoading = false;
              });
      },
      getDetailList(row) {
          this.preReqLoading = true;
          this.$tool
              .request({
                  url: "REQ/REQ1/REQ112",
                  method: "post",
                  data: {
                      action: "querymixsampleldetail",
                      mixbarcode: row.mixbarcode,
                  },
              })
              .then((response) => {
                  this.preReqLoading = false;
                  this.preReqList = response.data;
              })
              .catch((e) => {
                  this.preReqLoading = false;
              });
      },
      deleteSample(tableref) {
          var that = this;
          let row = that.$refs.xTable.getCurrentRow();
          if (!row) return false;
          that.$confirm("是否要从混样信息中删除 " + row.pat_name + "?", "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              type: "warning",
          }).then(() => {
              that.exeDeleteSample(row, that.mixbarcode, 0).then((response) => {
                  if (response.flag == 1) {
                      //更新混样主条码包含明细条码的数量
                      this.$tool
                          .request({
                                  url: "REQ/REQ1/REQ112",
                                  method: "post",
                                  data: {
                                      action: "updatemixnum",
                                      mixbarcode: that.mixbarcode,
                                  },
                          })
                          .then((res) => {
                              if (res.flag == "-1") {
                                  that.$pub.message(that, res.msg, "warning");
                              }
                              else{
                                  that.$pub.message(that, "删除成功！", "warning");
                                  that.deleteTable(tableref, row);
                              }
                          })
                  } else if (response.flag == 0) {
                      that.deleteAlert(row, that.mixbarcode, response.msg, tableref);
                  } else {
                      that.$pub.message(that, response.msg, "error");
                  }
              });
          });
      },
      childrenDeal(row) {
          var that = this;
          that.$confirm("是否要从混样信息中删除 " + row.pat_name + "?", "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              type: "warning",
          }).then(() => {
              that.exeDeleteSample(row, that.selrow.mixbarcode, 0).then((response) => {
                  console.log(response);
                  if (response.flag == 1) {
                      //更新混样主条码包含明细条码的数量
                      this.$tool
                          .request({
                                  url: "REQ/REQ1/REQ112",
                                  method: "post",
                                  data: {
                                      action: "updatemixnum",
                                      mixbarcode: that.selrow.mixbarcode,
                                  },
                          })
                          .then((res) => {
                              if (res.flag == "-1") {
                                  that.$pub.message(that, res.msg, "warning");
                              }
                              else{
                                  that.deleteTable("preReq", row);
                              }
                          })
                  } else if (response.flag == 0) {
                      that.deleteAlert(row, that.selrow.mixbarcode, response.msg, "preReq");
                  } else {
                      that.$pub.message(that, response.msg, "error");
                  }
              });
          });
      },
      async exeDeleteSample(row, mixbarcode, execflag) {
          let response = await this.$tool.request({
              url: "REQ/REQ1/REQ112",
              method: "post",
              data: {
                  action: "deletedetail",
                  barcode: row.barcode,
                  mixbarcode: mixbarcode,
                  execflag: execflag,
              },
          });
          return response;
      },
      deleteAlert(row, mixbarcode, errormsg, tableref) {
          var that = this;
          that.$confirm(errormsg, "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              type: "warning",
          }).then(() => {
              that.exeDeleteSample(row, mixbarcode, 1).then((response) => {
                  if (response.flag == 1) {
                      //更新混样主条码包含明细条码的数量
                      this.$tool
                          .request({
                                  url: "REQ/REQ1/REQ112",
                                  method: "post",
                                  data: {
                                      action: "updatemixnum",
                                      mixbarcode: mixbarcode,
                                  },
                          })
                          .then((res) => {
                              if (res.flag == "-1") {
                                  that.$pub.message(that, res.msg, "warning");
                              }
                              else{
                                  that.$pub.message(that, "删除成功！", "warning");
                                  that.deleteTable(tableref, row);
                              }
                          })
                  } else if (response.flag == 0) {
                      that.deleteAlert(row, response.msg, mixbarcode, tableref);
                  } else {
                      that.$pub.message(that, response.msg, "error");
                  }
              });
          });
      },
      deleteTable(table, delrow) {
          var havedata = this.$refs[table].getTableData().fullData;
          if (delrow && havedata.length > 0) {
              var rowindex = havedata.indexOf(delrow);
              this.$refs[table].remove(delrow);
              if (havedata.length > 0) {
                  console.log(rowindex);
                  if (rowindex == 0) {
                      this.$refs[table].setCurrentRow(this.$refs[table].getTableData().fullData[0]);
                  } else {
                      if (rowindex >= havedata.length) {
                          rowindex = havedata.length - 1;
                      }
                      let selectrow = havedata[rowindex - 1];
                      this.$refs[table].setCurrentRow(selectrow);
                  }
              }
          }
          this.getFocus();
      },
      currentChangeEvent({ row }) {
          this.selrow = row;
          this.isadddetail = row.req_stat >= 4;
          this.detailBarcode = "";
          this.selgroupbarcode = row.mixbarcode;
          this.getDetailList(row);
      },
      addDetail(e) {
          let that = this;
          let barcode = e.target.value;
          let selectrow = that.$refs.reqGroup.getCurrentRow();
          if (!selectrow) return false;
          let mixbarcode = selectrow.mixbarcode;
          if (this.isadddetail) {
              this.$pub.message(this, "混采条码被接收或者上机,不允许新增子条码！", "warning");
              return false;
          }
          if (barcode && mixbarcode) {
              that.exeScanBarcode(barcode, mixbarcode, 0, 1);
          }
      },
      scanDetBarcode(barcode, mixbarcode, execflag, addflag) {
          let response = this.$tool.request({
              url: "REQ/REQ1/REQ112",
              checkreturn: "1",
              method: "post",
              data: {
                  action: "scanbarcode",
                  barcode: barcode,
                  mixbarcode: mixbarcode,
                  execflag: execflag,
                  addflag: addflag,
              },
          });
          if (response.flag < 0) {
              this.$message(response.msg);
              this.$nextTick(() => {
                  this.$refs.reqbarcode.focus();
                  this.$refs.reqbarcode.select();
              });
              return;
          }
          return response;
      },
      exeScanBarcode(barcode, mixbarcode, execflag, addflag) {
          //防止数据并发
          this.isadddetail = true;
          let that = this;
          that.scanDetBarcode(barcode, mixbarcode, execflag, addflag).then((response) => {
              if (response.flag == 1) {
                  //更新混样主条码包含明细条码的数量
                  this.$tool
                      .request({
                          url: "REQ/REQ1/REQ112",
                          method: "post",
                          data: {
                              action: "updatemixnum",
                              mixbarcode: mixbarcode,
                          },
                      })
                      .then((res) => {
                          if (res.flag == "-1") {
                              that.$pub.message(that, res.msg, "warning");
                          }
                          else{
                              that.preReqList = response.allData;
                              that.$refs.preReq.reloadData(that.preReqList).then(() => {
                                  let newRow = that.preReqList.find((t) => t.barcode == barcode);
                                  if (newRow) {
                                      that.$refs.preReq.setCurrentRow(newRow);
                                      that.$refs.preReq.scrollToRow(newRow);
                                  }
                                  that.$refs.detailBarcode.select();
                              });
                          }
                      })
              } else if (response.flag == 0) {
                  that.$confirm(response.msg, "提示", {
                      confirmButtonText: "确定",
                      cancelButtonText: "取消",
                      type: "warning",
                  }).then(() => {
                      that.exeScanBarcode(barcode, mixbarcode, 1, addflag);
                  });
              } else {
                  that.$pub.message(that, response.msg, "error");
              }
              this.isadddetail = false;
              this.$nextTick(() => {
                  this.$refs.detailBarcode.focus();
                  this.$refs.detailBarcode.select();
              });
              this.queryList();
          });
      },
  },
};
</script>

<style scoped>
.mytable-style {
  height: 100%;
}
.page-top {
  width: 100%;
  height: 70px;
  border: 1px solid #ccc;
  /* position: absolute; */
  font-size: 12px;
  padding: 5px 0;
  line-height: 24px;
  overflow-x: auto;
  overflow-x: overlay;
}
::-webkit-scrollbar {
  width: 0px;
  height: 5px;
  border: 4px solid white;
}
::-webkit-scrollbar-thumb {
  background-color: #c1c1c1;
}
::-webkit-scrollbar-track {
  background-color: #f1f1f1;
}
.page-top-info {
  display: flex;
  margin-bottom: 5px;
}
.page-top .el-radio {
  margin-right: 10px;
}
/deep/ .page-top .el-input__prefix {
  left: 0px !important;
}
/deep/ .page-top .el-input--prefix .el-input__inner {
  padding: 0 20px !important;
}
/deep/ .page-top .el-input__icon {
  width: 20px !important;
}
.search-title {
  margin: 0 5px;
}
.search-text {
  width: 135px;
}
.right-top-deal {
  display: flex;
  justify-content: space-between;
  padding: 0 5px;
}
.top-deal {
  height: 25px;
  margin-right: 5px;
  text-align: right;
}
.page-bottom {
  margin-top: 5px;
  height: calc(100% - 75px);
}
.page-content {
  height: 100%;
}
.detail-info {
  display: flex;
  margin: 2px 0;
  line-height: 28px;
}
/deep/ .table-bottom-content .vxe-table .vxe-table--body-wrapper {
  height: calc(100% - 32px);
}
/deep/ .table-bottom-content .vxe-table--empty-block {
  height: calc(100% - 32px);
}
</style>
